package com.ming.interview;

import java.util.Scanner;

/**
 * @Description 一个数如果恰好等于它的因子之和，这个数就称为”完数”。例如6=1＋2＋3.编程找出1000以内的所有完数。
 * @Author ye.ming
 * @Date Created in 2019/8/26
 */
public class Main8 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        m1(n);
        sc.close();
    }


    private static void m1(int m) {
        int count = 1;
        for (int i = 1; i <= m; i++) {
            int sum = 0;
            for (int j = 1; j < i / 2 + 1; j++) {
                if (i % j == 0) {
                    sum += j;
                }
            }
            if (sum == i) {
                System.out.print(i + " ");
                count++;
            }
            if (count % 20 == 0) {
                System.out.println();
            }
        }
    }


}
